﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using log4net;
using System.Reflection;

namespace WebUI
{
    public class LogExceptionFilterAttribute : FilterAttribute, IExceptionFilter
    {
        private readonly ILog _log;

        public LogExceptionFilterAttribute()
        {
            _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
        }

        public void OnException(ExceptionContext filterContext)
        {
            _log.Error(filterContext.Exception);
        }
    }
}